class Piece:

    #constructor
    def __init__(self):
        self.x = 0
        self.y = 0
        self.letter = ""

    @classmethod
    def parse(cls, line):
        """parses a move string into correct array index
         e.g. A3 L becomes y=0, x=2 and letter L"""
        
        split = line.split()

        p = Piece() 

        #letter converted to y value (0 bound) index using order value, always single char
        p.y = ord(split[0][0]) - 65  
        # use rest of string a x value index.  remove 1 to make as 0 bound
        p.x = int(split[0][1:]) - 1  
        #save letter
        p.letter = split[1]
        
        return p

    def __eq__(self, b):
        if self.x == b.x and self.y == b.y:
            return True
        return False

    def __repr__(self):
        """pretty print of class"""
        return "x: " + str(self.x) + " y: " + str(self.y) + " Letter: " + self.letter
